﻿<Window x:Class="MissedMemo.MeatAndCheeseDisc.OrderMonitor.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:MissedMemo.MeatAndCheeseDisc.OrderMonitor"
    Title="MeatAndCheeseDisc Kitchen Orders"
    Height="500" Width="400">

    <Window.Resources>
        <ResourceDictionary>

            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="resOrderTemplates.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <!-- Technique to hide ListBoxItem SELECTION border -->
            <Style TargetType="ListBoxItem">
                <Style.Resources>
                    <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/>
                    <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent"/>
                </Style.Resources>
            </Style>
            
        </ResourceDictionary>
    </Window.Resources>

    <Window.CommandBindings>
        <CommandBinding Command="{x:Static local:CustomCommands.CompleteOrderItem}" Executed="OnOrderItemCompleted" />
    </Window.CommandBindings>
    
    
    <Grid Margin="5" DataContext="{x:Static local:App.KitchenOrders}" >

        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="auto"/>
        </Grid.RowDefinitions>
        
        <ListBox Grid.Row="0" Name="listKitchenOrders" ItemsSource="{Binding}"
                 ItemTemplate="{StaticResource KitchenOrderDataTemplate}"
                 ScrollViewer.HorizontalScrollBarVisibility="Disabled" >
            
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel/>
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            
        </ListBox>
        
        <TextBlock Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" TextWrapping="Wrap"
                   Name="labelHint" Text="Generate demo orders, then SELECT an order to 'close' it" />
        
        <Button Grid.Row="1" HorizontalAlignment="Right" Margin="5" Padding="5,2"
                VerticalAlignment="Bottom" Click="OnSimulateNewOrder" >
            Simulate New Order
        </Button>
    
    </Grid>

</Window>
